<?php

/**
 * Tickets form base class.
 *
 * @method Tickets getObject() Returns the current form's model object
 *
 * @package    explications_informatiques
 * @subpackage form
 * @author     Guimezanes Cyrille
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseTicketsForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'idtickets' => new sfWidgetFormInputHidden(),
      'id_auteur' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('SfGuardUserProfile'), 'add_empty' => true)),
      'id_owner'  => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('SfGuardUserProfile_2'), 'add_empty' => true)),
      'title'     => new sfWidgetFormInputText(),
      'texte'     => new sfWidgetFormTextarea(),
      'category'  => new sfWidgetFormInputText(),
      'priority'  => new sfWidgetFormInputText(),
      'state'     => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'idtickets' => new sfValidatorChoice(array('choices' => array($this->getObject()->get('idtickets')), 'empty_value' => $this->getObject()->get('idtickets'), 'required' => false)),
      'id_auteur' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('SfGuardUserProfile'), 'required' => false)),
      'id_owner'  => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('SfGuardUserProfile_2'), 'required' => false)),
      'title'     => new sfValidatorString(array('max_length' => 150, 'required' => false)),
      'texte'     => new sfValidatorString(array('required' => false)),
      'category'  => new sfValidatorString(array('max_length' => 7, 'required' => false)),
      'priority'  => new sfValidatorString(array('max_length' => 15, 'required' => false)),
      'state'     => new sfValidatorString(array('max_length' => 1, 'required' => false)),
    ));

    $this->widgetSchema->setNameFormat('tickets[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Tickets';
  }

}
